import { createSSRApp } from "vue";

import { useShare } from "@/hooks/useShare";
import App from "./App.vue";

// 导入 pinia 实例
import pinia from "./stores";

import "./styles/index.scss";

import uviewPlus from "uview-plus";

export function createApp() {
  // 创建 vue 实例
  const app = createSSRApp(App);

  //#ifdef MP-WEIXIN
  // 全局分享配置
  const shareConfig = useShare();

  app.mixin({
    onShareAppMessage: shareConfig.onShareAppMessage,
    onShareTimeline: shareConfig.onShareTimeline
  });
  // #endif

  // 使用 pinia
  app.use(pinia).use(uviewPlus);

  return {
    app
  };
}
